package com.spa.infrastructure.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.spa.application.command.admin.UserInfoLogOffCommand;
import com.spa.application.command.member.MemberUserInfoEditCommand;
import com.spa.application.dto.PageResult;
import com.spa.application.dto.admin.UserInfoDto;
import com.spa.application.dto.member.MemberUserInfoDTO;
import com.spa.application.query.member.UserInfoQuery;
import com.spa.domain.entity.UserInfo;
import com.spa.infrastructure.repository.condition.UserInfoCondition;
import com.spa.infrastructure.repository.po.UserInfoPO;
import org.mapstruct.Mapper;
import org.mapstruct.MapperConfig;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
@MapperConfig(unmappedTargetPolicy = ReportingPolicy.WARN)
public interface UserInfoMapperStruct {

    UserInfoMapperStruct INSTANCE = Mappers.getMapper(UserInfoMapperStruct.class);

    UserInfo po2Entity(UserInfoPO po);

    List<UserInfo> po2Entity4List(List<UserInfoPO> po);

    UserInfoCondition query2Condition(UserInfoQuery query);

    UserInfoPO command2Po(MemberUserInfoEditCommand command);

    UserInfoCondition command2LogOff(UserInfoLogOffCommand userInfoLogOffCommand);

    MemberUserInfoDTO entity2Dto(UserInfo entity);

    // 运营端用户查询
    UserInfoCondition query3Condition(com.spa.application.query.admin.UserInfoQuery userInfoQuery);

    // 转换查询结果UserInfoPO->UserInfo
    Page<UserInfo> po2Entity4Page(Page<UserInfoPO> po);
    // 转换查询结果
    PageResult<UserInfoDto> entity2UserInfoDto4Page(Page<UserInfo> userInfoPage);

}
